golang convert int to string

135

golang parse float64 -

f, err := strconv.ParseFloat("3.1415", 64)

Golang strconv, Convert Int to String -

Golang program that casts float to int

package main

import "fmt"

func main() {
    size := 1.2
    fmt.Println(size)

    // Convert to an int with a cast.
    i := int(size)
    fmt.Println(i)
}

Output

1.2
1

Comments

Submit
0 Comments